package com.baidu.location;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.provider.Settings.Secure;
import android.provider.Settings.System;
import android.text.TextUtils;
import java.util.UUID;

public class al
{
  private static final String a = al.class.getSimpleName();

  public static String a(Context paramContext)
  {
    Object localObject4 = paramContext.getSharedPreferences("bids", 0);
    Object localObject1 = ((SharedPreferences)localObject4).getString("i", null);
    Object localObject2 = localObject1;
    if (localObject1 == null)
    {
      localObject2 = am.a(paramContext);
      localObject1 = ((SharedPreferences)localObject4).edit();
      ((SharedPreferences.Editor)localObject1).putString("i", (String)localObject2);
      ((SharedPreferences.Editor)localObject1).commit();
    }
    Object localObject3 = ((SharedPreferences)localObject4).getString("a", null);
    localObject1 = localObject3;
    if (localObject3 == null)
    {
      localObject3 = Settings.Secure.getString(paramContext.getContentResolver(), "android_id");
      localObject1 = localObject3;
      if (TextUtils.isEmpty((CharSequence)localObject3))
        localObject1 = "";
      localObject3 = ((SharedPreferences)localObject4).edit();
      ((SharedPreferences.Editor)localObject3).putString("a", (String)localObject1);
      ((SharedPreferences.Editor)localObject3).commit();
    }
    localObject3 = ak.a("com.baidu" + ((String)localObject2) + ((String)localObject1).getBytes());
    localObject4 = Settings.System.getString(paramContext.getContentResolver(), (String)localObject3);
    if (TextUtils.isEmpty((CharSequence)localObject4))
    {
      localObject4 = UUID.randomUUID().toString();
      localObject2 = ak.a(((String)localObject2) + ((String)localObject1) + ((String)localObject4).getBytes());
      Settings.System.putString(paramContext.getContentResolver(), (String)localObject3, (String)localObject2);
      localObject1 = localObject2;
      if (((String)localObject2).equals(Settings.System.getString(paramContext.getContentResolver(), (String)localObject3)));
    }
    for (localObject1 = localObject3; ; localObject1 = localObject4)
    {
      localObject2 = am.a(paramContext);
      paramContext = (Context)localObject2;
      if (TextUtils.isEmpty((CharSequence)localObject2))
        paramContext = "0";
      paramContext = new StringBuffer(paramContext).reverse().toString();
      return ((String)localObject1) + "|" + paramContext;
    }
  }
}